<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>$refs</title>
    <script src="https://cdn.jsdelivr.net/npm/vue"></script>
</head>
<body>
<div id="app">
    <label>
        <input type='text' ref='input1' />
    </label>
    <button @click='add'> 添加数值</button>

</div>

<script>
    var app= new Vue({
        el:'#app',
        data:{

        },
        methods:{
            add:function(){
//this.$refs.input1  减少获取dom节点的消耗
                this.$refs.input1.value ="10";
            }
        }
    })
</script>
</body>
</html>
